<!--清算账户日报表查询页面-->
<template>
  <div class="app-container">
    <div style="width: 1024px;margin: 20px auto">
      <el-form ref="entryForm" :model="formData" label-width="90px" style="margin-top: 50px">
        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="CPG日期：" prop="workdate">
              <el-date-picker
                v-model="formData.workdate"
                type="date"
                value-format="yyyyMMdd"
                placeholder="选择日期"
                style="width: 100%;"
              ></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="工作日期：" prop="workdate2">
              <el-date-picker
                v-model="formData.workdate2"
                type="date"
                value-format="yyyyMMdd"
                placeholder="选择日期"
                style="width: 100%;"
              ></el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div class="bottom-control">
        <el-button type="primary" @click="checkFn">查看明细</el-button>
        <el-button type="warning" @click="resetFn">重置</el-button>
      </div>
    </div>
    <account-details :detailsForm="detailsForm" :dictMap="dictMap" ref="accountDetailsDialog"></account-details>
  </div>
</template>
<script>
import { detail } from "@/api/cnaps/saps/otherCommQuery/clear_account_query.js";
import { listPageMixin } from "@/libs/listPageMixin";
import AccountDetails from "./components/accountDetails";
import { log } from "util";

export default {
  name: "clearAccountQuery",
  mixins: [listPageMixin],
  components: { AccountDetails },
  data() {
    return {
      //数据字典
      searchFormDictList: ["TXN_TYPE"],
      detailsForm: {},
      formData: {
        workdate: "",
        workdate2: "",
      },
    };
  },
  mounted() {},
  methods: {
    reset() {
      this.resetForm("entryForm");
      this.$set(this, "formData", {});
    },
    checkFn() {
      if ((this.formData.workdate == "" && this.formData.workdate2 == "")||(this.formData.workdate == undefined && this.formData.workdate2 == undefined)) {
        this.$confirm("请输入CPG期日或工作日期", "系统提示", {
          confirmButtonText: "确定",
          showCancelButton: false,
          type: "warning",
        }).catch(err => {});
        return;
      }
      detail(this.formData).then(res => {
        console.log(res, "详情");
        this.detailsForm = _.clone(res.result);
        this.$refs.accountDetailsDialog.show();
      });
    },
    resetFn() {
      this.reset();
    },
  },
};
</script>
<style lang="scss" scoped>
.bottom-control {
  margin: 30px 0;
  text-align: center;
}
</style>
